This is a set of ImageJ macros for completing commonly used ImageJ functions on an entire folder of images.
Batch processing macros are an important aspect of any kind of experiment with multiple Images present for a number of reasons. - It is faster - Allows for other work to be done while it runs in the background - Massively reduces the chance of error - Ensures that all files are correctly processed in the same way - Makes your workflow substantially more reproducible and transparent
The aim of this project is to have a robust toolkit which is easy to use for even those with no ImageJ experience and can compute large volumes of images even with limited computational power.
I have also added templates which can be used to create your own macros from with instructions at the bottom. I hope this will allow people who have never used ImageJ macros before to be able to produce their own batch processing macros.
They all work on Windows and Linux, and should work on Mac too, but I have not had the opportunity to test this.
Most of these Macros only work with .tif input files, but there is a macro to convert images from other proprietary formats to .tif and one of the macro templates contains this functionality.
In the repository there is a folder called “Templates”, this contains files for making your own Macros in the same format as mine, but for different functions. The template contains all the code for working with photos in batch from a folder, then there is a free space for you to put in the function of the macro.
Creates a GUI asking for use Inputs
Opens up a selected folder and create a list of relevant files
Opens each file in this list
space for user input
Renames the file and saves to selected folder
Gives simple updates throughout
The first thing you need to do is get the code for the process you want the macro to complete.
The easiest way to do this is using the “Record Macro” tool which shows you the code for any action you manually complete.
This will open a new “recording” window which should be empty
Once you have done this there will be code in the “recorder” window
In this case I wanted to ask for saturation, so firstly I need to change the saturation value to a variable instead of a fixed value.
First, highlight the fixed value, press the quotation mark button then backspace.
This opens up a gap in the fixed text in which you can put in a variable name surrounded by 2 plusses, like this:
Then you need to take the pre-made entry code at the top of the document and change the label and the name of the stored variable (word at the end of the line) accordingly.
You should remove any lines of the GUI code which you are not using, but it shouldn’t break if you don’t
Hopefully there shouldn’t be any bugs, but I can’t promise anything
If you follow these steps then you can create a functioning macro that looks like this: